找传奇、传世资源到传世资源站!

android 自定义listview列表

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

android 自定义listview列表 Java-第1张
package com.cn.main;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ExpandableListView;

public class MainActivity extends Activity {
    ExpandableListView mExpandableListView;
    ExpandableListViewAdapter mExpandableListViewAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mExpandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
        mExpandableListViewAdapter = new ExpandableListViewAdapter(this);
        mExpandableListView.setAdapter(mExpandableListViewAdapter);
        mExpandableListView.expandGroup(0);
//        openAll() ;
        mExpandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
            @Override
            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
                // TODO Auto-generated method stub
//                Log.e("hefeng", "ExpandableListView GroupClickListener groupPosition=" groupPosition);
                return false;
            }
        });
        mExpandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
            @Override
            public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
                // TODO Auto-generated method stub
                Log.e("hefeng", "ExpandableListView ChildClickListener groupPosition=" groupPosition "||childPosition=" childPosition);
                return false;
            }
        });
     
    }

    private void openAll() {
        int groupCount = mExpandableListView.getCount();
        for (int i = 0; i < groupCount; i ) {
            mExpandableListView.expandGroup(i);
        }
        ;
    }

}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复